package cn.yudao.config;

import com.netflix.loadbalancer.RandomRule;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootConfiguration
public class httpSendConfig {

    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

    //负载均衡算法 随机分配的 配置全局负载均衡调度算法
    @Bean
    public RandomRule randomRule(){
        return new RandomRule();
    }

}
